package com.syezon.wifikey.pwd;

import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.syezon.android.base.eventbus.EventCenter;
import com.syezon.wifikey.R;
import com.syezon.wifikey.base.BaseLazyFragment;
import com.syezon.wifikey.pwd.adapter.CommonPwdAdapter;

import butterknife.BindView;


public class CommonPwdFragment extends BaseLazyFragment {

    @BindView(R.id.refreshLayout)
    SmartRefreshLayout mRefreshLayout;
    @BindView(R.id.rv_list)
    RecyclerView mRvList;
    CommonPwdAdapter mAdapter;

    public CommonPwdFragment() {
    }

    public static CommonPwdFragment newInstance() {
        CommonPwdFragment commonPwdFragment = new CommonPwdFragment();
        return commonPwdFragment;
    }


    @Override
    protected void onFirstUserVisible() {

    }

    @Override
    protected void onUserVisible() {

    }

    @Override
    protected void onUserInvisible() {

    }

    @Override
    protected View getLoadingTargetView() {
        return null;
    }

    @Override
    protected void initViewsAndEvents() {
        mRefreshLayout.setEnableRefresh(false);
        mRefreshLayout.setEnableLoadMore(false);
        mAdapter = new CommonPwdAdapter(getContext());
        mRvList.setLayoutManager(new LinearLayoutManager(getContext()));
        DividerItemDecoration divider = new DividerItemDecoration(getContext(), LinearLayoutManager.VERTICAL);
        divider.setDrawable(getResources().getDrawable(R.drawable.bg_divider));
        mRvList.addItemDecoration(divider);
        mRvList.setAdapter(mAdapter);
    }

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.fragment_common_pwd;
    }

    @Override
    protected void onEventComming(EventCenter eventCenter) {

    }

    @Override
    protected boolean isBindEventBusHere() {
        return false;
    }
}
